<template>
  <div>
    <div class="nav">
      <slot></slot>
      <span>{{ items.length }}</span>
    </div>
    <div class="item" v-for="item of items" :key="item.name">
      <input type="checkbox" v-model="item.state" />
      <h4>{{ item.name }}</h4>
      <button @click="delItem(item.name)">删除</button>
    </div>
  </div>
</template>

<script setup>
defineProps({
  items: {
    type: Array,
  },
});
const $emit = defineEmits(["delete"]);
const delItem = (name) => {
  $emit("delete", name);
};
</script>

<style scoped>
.nav {
  display: flex;
}
.item {
  display: flex;
  /* justify-content: space-around; */
}
</style>
